package com.ljx.itbbs.server.user.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.ljx.itbbs.server.user.dao.PermsCategoryDao;
import com.ljx.itbbs.server.user.domain.entity.PermsCategoryEntity;
import com.ljx.itbbs.server.user.domain.entity.PermsEntity;
import com.ljx.itbbs.server.user.domain.vo.req.PermsCategoryUpdateReq;
import com.ljx.itbbs.server.user.domain.vo.resp.PermsCategoryResp;
import com.ljx.itbbs.server.user.service.PermsCategoryService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermsCategoryServiceImpl implements PermsCategoryService {

    @Autowired
    private PermsCategoryDao permsCategoryDao;

    @Override
    public void savePermsCategory(PermsCategoryEntity permsCategoryEntity) {
        permsCategoryDao.save(permsCategoryEntity);
    }

    @Override
    public List<PermsCategoryResp> getPermsCategory() {
        return BeanUtil.copyToList(permsCategoryDao.list(), PermsCategoryResp.class);
    }

    @Override
    public void updatePermsCategory(PermsCategoryUpdateReq req) {
        permsCategoryDao.updatePermsCategory(req);
    }
}
